package org.come.Jpanel;

import cn.hutool.core.util.StrUtil;
import org.come.entity.RoleSummoning;
import java.awt.Font;
import com.tool.tcpimg.UIUtils;
import come.tool.Fighting.FightingMixDeal;

import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.image.ImageObserver;

import org.come.mouslisten.WLLMouslisten;
import org.come.mouslisten.ZDCYMouslisten;
import org.come.until.FormsManagement;
import org.come.until.UserMessUntil;
import org.come.until.ZipUtils;
import java.awt.Graphics;
import java.awt.Color;
import java.awt.Dimension;
import javax.swing.*;

//新版战斗自动显示
public class MsgJapnel5 extends JPanel {
    public String sublime;
    public String subsumpet;
    private ImageIcon iconS;

    //取消
    private JLabel cancel;

    //自动
    private JLabel auto;

    public MsgJapnel5() {
        this.setLayout(null);
        this.setPreferredSize(new Dimension(150, 94));
        this.setBackground(new Color(0, 0, 0, 0));

        this.cancel = new JLabel();
        this.cancel.setBounds(30,70, 34,20);
        cancel.addMouseListener(new MouseListener() {
            @Override
            public void mouseClicked(MouseEvent e) {
                FightingMixDeal.zdhh = 0;
                FormsManagement.HideForm(634);
            }

            @Override
            public void mousePressed(MouseEvent e) {

            }

            @Override
            public void mouseReleased(MouseEvent e) {}

            @Override
            public void mouseEntered(MouseEvent e) {

            }

            @Override
            public void mouseExited(MouseEvent e) {}
        });
        this.add(this.cancel);

        this.auto = new JLabel();
        this.auto.setBounds(80,70, 34,20);
        auto.addMouseListener(new MouseListener() {
            @Override
            public void mouseClicked(MouseEvent e) {
                FightingMixDeal.zdhh = 9999;
                FormsManagement.showForm(634);
            }

            @Override
            public void mousePressed(MouseEvent e) {
                new WLLMouslisten(9999);
            }

            @Override
            public void mouseReleased(MouseEvent e) {}

            @Override
            public void mouseEntered(MouseEvent e) {

            }

            @Override
            public void mouseExited(MouseEvent e) {}
        });
        this.add(this.auto);
    }

    @Override
    protected void paintComponent(final Graphics g) {
        super.paintComponent(g);
        if (this.iconS == null) {
            this.iconS = new ImageIcon("inkImg/old/1/ZD.png");
        }
        final RoleSummoning pet = UserMessUntil.getChosePetMes();
        if (pet == null) {
            this.subsumpet = "";
        }
        g.drawImage(this.iconS.getImage(), 0, 0, 150, 94, (ImageObserver)this);
        if (FightingMixDeal.zdhh != 0) {
            g.setColor(Color.white);
            g.drawString("自动还剩余", 15, 23);
            g.setColor(Color.red);
            g.setFont(UIUtils.TEXT_FONT2);
            g.drawString(FightingMixDeal.zdhh + "", 78, 23);
            g.drawString(FightingMixDeal.zdhh + "", 79, 23);
            g.setColor(Color.white);
            g.setFont(new Font("宋体", 0, 12));
            g.drawString("回合", 107, 23);
            g.drawString("人 物", 15, 42);
            g.drawString("召唤兽", 15, 60);
            g.setColor(new Color(255, 251, 153));
            if (this.sublime == null && this.subsumpet == null) {
                this.sublime = "普通攻击";
                this.subsumpet = "普通攻击";
            }
            if (this.sublime != null) {
                g.drawString(this.sublime, 79, 42);
            }
            if (pet != null && StrUtil.isNotBlank(this.subsumpet)) {
                g.drawString(this.subsumpet, 79, 60);
            }
            g.setColor(Color.green);
            g.drawString("取消      自动", 30, 82);
        }
    }
}
